#include <Box2D.h>
#include "common.h"

#ifdef __cplusplus
extern "C" {
#endif

JNIEXPORT jfloat JNICALL Java_b2RevoluteJointDef_jni_1b2RevolutionJointDef_1Initialize
  (JNIEnv * env, jclass cls, jint _localAnchorA, jint _localAnchorB,
			jint _bodyA, jint _bodyB, jint _anchor)
{
	b2Body* bodyA = (b2Body*)_bodyA;
	b2Body* bodyB = (b2Body*)_bodyB;

	b2Vec2* localAnchorA = (b2Vec2*)_localAnchorA;
	b2Vec2* localAnchorB = (b2Vec2*)_localAnchorB;
	b2Vec2* anchor = (b2Vec2*)_anchor;

	*localAnchorA = bodyA->GetLocalPoint(*anchor);
	*localAnchorB = bodyB->GetLocalPoint(*anchor);

	return bodyB->GetAngle() - bodyA->GetAngle();
}

#ifdef __cplusplus
}
#endif
